﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Sharp.Domain.Model;
using Sharp.Domain.PlatformBoundedContext.WorkFlowModule.Engine.Common;
using Sharp.Infrastructure;

namespace Sharp.Domain.PlatformBoundedContext.WorkFlowModule.Aggregates
{
    /// <summary>
    /// 节点转移类
    /// </summary>
    [Table("WorkFlow_TransitionInstances")]
    public class TransitionInstanceEntity : IAggregateRoot<int>, ILogCreatedExEntity
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Column(Order = 0)]
        public int Id { get; set; }

        [Required]
        [Column(  Order = 1)]
        [MaxLength(100), NonUnicode]
        public string TransitionGUID { get; set; }

        [Required]
        [Column( Order = 2)]
        [MaxLength(50)]
        public string AppName { get; set; }

        [Required]
        [Column(  Order = 3)]
        [MaxLength(50), NonUnicode]
        public string AppInstanceID { get; set; }

        [Required]
        [Column(Order = 4)]
        public int ProcessInstanceID { get; set; }

        [Required]
        [Column( Order = 5)]
        [MaxLength(100), NonUnicode]
        public string ProcessGUID { get; set; }

        [Required]
        [Column(Order = 6)]
        public TransitionTypeEnum TransitionType { get; set; }

        [Required]
        [Column(Order = 7)]
        public TransitionFlyingTypeEnum FlyingType { get; set; }

        [Required]
        [Column(Order = 8)]
        public int FromActivityInstanceID { get; set; }

        [Required]
        [Column(  Order = 9)]
        [MaxLength(100), NonUnicode]
        public string FromActivityGUID { get; set; }

        [Required]
        [Column(Order = 10)]
        public ActivityTypeEnum FromActivityType { get; set; }

        [Required]
        [Column( Order = 11)]
        [MaxLength(50)]
        public string FromActivityName { get; set; }

        [Required]
        [Column(Order = 12)]
        public int ToActivityInstanceID { get; set; }

        [Required]
        [Column( Order = 13)]
        [MaxLength(100), NonUnicode]
        public string ToActivityGUID { get; set; }

        [Required]
        [Column(Order = 14)]
        public ActivityTypeEnum ToActivityType { get; set; }

        [Required]
        [Column( Order = 15)]
        [MaxLength(50)]
        public string ToActivityName { get; set; }

        [Required]
        [Column(Order = 16)]
        public ConditionParseResultEnum ConditionParseResult { get; set; }

        [Required]
        [Column(  Order = 17)]
        public int? CreatedUserId { get; set; }

        [Required]
        [Column(  Order = 18)]
        [MaxLength(50), NonUnicode]
        public string CreatedUserName { get; set; }

        [Required]
        [Column( Order = 19)]
        public System.DateTime? CreatedTime { get; set; }

        [Required]
        [Column(Order = 20)]
        public byte RecordStatusInvalid { get; set; }

        [Timestamp]
        [Column( Order = 21)]
        public byte[] RowVersionID { get; set; }


        public virtual ActivityInstanceEntity ToActivityInstance { get; set; }
    }
}
